package com.chuji.crmcj.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chuji.crmcj.R;
import com.chuji.crmcj.utils.UIUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by w.pitt on 2016/2/25.
 */
public class GvDialogAda extends BaseAdapter {
    public Map<String, Double> map;
    public List<String> keys;

    public GvDialogAda(Map<String, Double> map) {
        this.map = map;
    }

    @Override
    public int getCount() {
        return map==null ? 0 : map.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(UIUtils.getContext(), R.layout.dialog_item_bottm, null);
        TextView mTvItem = (TextView) convertView.findViewById(R.id.tv_item);
        keys = new ArrayList<String>();
        for (Map.Entry<String, Double> entry : map.entrySet()) {
            keys.add(entry.getKey());
        }
        mTvItem.setText(keys.get(position));
        return convertView;
    }
}
